package org.yefei.homeworkday14;

public class Cat extends Animal {
	private String color;
	private int length;

	public Cat() {
	}

	public Cat(String name, int age, double weight, String color) {
		super(name, age, weight);
		this.color = color;
	}

	public Cat(String name, int age, double weight, String color, int length) {
		this(name, age, weight, color);
		this.length = length;
	}

	public String getColor() {
		return color;
	}

	public void setColor(String color) {
		this.color = color;
	}

	public int getLength() {
		return length;
	}

	public void setLength(int length) {
		if (length < 0) {
			System.err.println("猫的身长不能小于0cm");
			length = 50;
		}
		this.length = length;
	}

	public void catchMouse(String h) {
		System.out.println("名叫" + super.getName() + "的小猫猫会抓" + h);
	}

	@Override
	public void shout() {
		System.out.println("名叫" + super.getName() + "的小猫猫会叫！");
	}

	public void run() {
		System.out.println("名叫" + super.getName() + "的小猫猫会跑！");
	}
}
